<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>会员登录页面</title>
    <!-- 静态包含头信息!-->
    <%@include file="/pages/common/hand.jsp" %>
    <script>
        $(function () {
            $("#sub_btn").click(function () {
                var username = $(".itxt[type = text]").val();
                var password = $(".itxt[type = password]").val();
                var usernamePutt = /^[a-z0-9_-]{3,16}$/;
                var passwordPutt = /^[a-z0-9_-]{6,18}$/;
                var errormas = $(".errorMsg");
                if (!usernamePutt.test(username)) {
                    errormas.text("用户名格式错误");
                    return false;
                } else if (!passwordPutt.test(password)) {
                    errormas.text("密码格式错误");
                    return false;
                } else {
                    errormas.text("");
                    return true;
                }
            });
        });

    </script>

</head>
<body>
<div id="login_header">
    <img class="logo_img" alt="" src="static/img/logo.jpg">
</div>

<div class="login_banner">

    <div id="l_content">
        <span class="login_word">欢迎登录</span>
    </div>

    <div id="content">
        <div class="login_form">
            <div class="login_box">
                <div class="tit">
                    <h1>欢迎登陆</h1>
                    <a href="pages/user/regist.jsp">立即注册</a>
                </div>
                <div class="msg_cont">
                    <b></b>
                    <%--  检查回显信息--%>
                    <span class="errorMsg">
                        ${empty requestScope.errorMas?"请输入用户名和密码":requestScope.errorMas}
                    </span>
                </div>
                <div class="form">
                    <form action="/project/UserServlet" method="post">
                        <input type="hidden" name="type" value="login">
                        <label>用户名称：</label>
                        <%--  检查回显信息--%>
                        <input class="itxt" type="text" placeholder="请输入用户名" autocomplete="off" tabindex="1"
                               name="username"
                               value= ${empty requestScope.userNameBack?"":requestScope.userNameBack}>

                        <br/>
                        <br/>
                        <label>用户密码：</label>
                        <input class="itxt" type="password" placeholder="请输入密码" autocomplete="off" tabindex="1"
                               name="password"/>
                        <br/>
                        <br/>
                        <input type="submit" value="登录" id="sub_btn"/>
                    </form>
                </div>

            </div>
        </div>
    </div>
</div>
<%@include file="/pages/common/footer.jsp" %>
</body>
</html>